package com.wbp.cms.client.common.domain;

import java.util.Date;
import java.util.List;

import com.google.common.collect.Lists;
import com.wbp.cms.client.common.BaseDO;


/**
 * @Description:
 * @Department:
 * @author andy.lhc
 * @date 2016年3月9日 下午2:28:25
 */
public class OrganizationDO extends BaseDO {
  /**
   * 
   */
  private static final long serialVersionUID = 5185600148648531781L;

  private Long id;

  private Date createTime;

  private Date updateTime;

  private String name;

  private String icon;

  private Integer status = 1; // 默认值; 1:正常

  private Long parentId = 0L; // 默认值 ; 顶级节点

  private Integer version;
  
  List<OrganizationDO>  children ;
  
  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getUpdateTime() {
    return updateTime;
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getIcon() {
    return icon;
  }

  public void setIcon(String icon) {
    this.icon = icon;
  }

  public Integer getStatus() {
    return status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public Long getParentId() {
    return parentId;
  }

  public void setParentId(Long parentId) {
    this.parentId = parentId;
  }

  public Integer getVersion() {
    return version;
  }

  public void setVersion(Integer version) {
    this.version = version;
  }

  public List<OrganizationDO> getChildren() {
    return children;
  }

  public void setChildren(List<OrganizationDO> children) {
    this.children = children;
  }
  
  public void addOrganization(OrganizationDO org){
    if(children == null)
      children = Lists.newArrayList() ;
    if(!children.contains(org))
      this.children.add(org) ;
  }
  
}
